{template 'public/header'}

{template 'public/comhead'}

<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>all));}">全部门店</a></li>
    <li   {if $type=='wait'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>wait,'status'=>1));}">营业门店</a></li>
    <li   {if $type=='ok'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>ok,'status'=>2));}">停业门店</a></li>
</ul>
<br>
<div class="row ygrow">
    <div class="col-lg-12">

        <form class="form-inline" action="" method="get">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="yzzc_sun" />
            <input type="hidden" name="do" value="branch_income" />
            <input type="hidden" name="token" value="{$_W['token']}"/>
            <div class="form-group">
                <label for="keyword">订单号</label>
                <input type="text" class="form-control" name="keywords" id="keyword" value="{$keywords}" placeholder="请输入订单号">
            </div>
            <div class="form-group">
                <label for="status">状态</label>
                <select class="form-control" id="status" name="status" style="width: 150px">
                    <option value="">请选择状态</option>
                    <option value="0" {if $status === "0" } selected {/if}>待结算</option>
                    <option value="1" {if $status == 1 } selected {/if}>已结算</option>
                </select>
            </div>
            <div class="form-group">
                <label for="branch_id">门店</label>
                <select class="form-control" id="branch_id" name="branch_id" style="width: 150px">
                    <option value="">请选择门店</option>
                    {loop $branch_list $index $item}
                    <option value="{$item['id']}" {if $branch_id == $item['id'] } selected {/if}>{$item['name']}</option>
                    {/loop}
                </select>
            </div>
            <div class="form-group">
                <label for="status">门店类型</label>
                <select class="form-control" id="type" name="type" style="width: 150px">
                    <option value="">请选择状态</option>
                    <option value="1" {if $type == 1 } selected {/if}>平台自营</option>
                    <option value="2" {if $type == 2 } selected {/if}>商家入驻</option>
                    <option value="3" {if $type == 3 } selected {/if}>个人商户</option>
                </select>
            </div>
            <input type="submit"  name="submit"  value="搜索" class="btn btn-default">
        </form>

        <div class="col-md-4">
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </div>
    </div><!-- /.col-lg-6 -->
</div>
<div class="row ygrow">
    <div class='col-lg-12'>
        <li><p style="margin-top: 6px;">待结算总金额：<label style="color: red">{$wait_amount}</label></p></li>
        <li><p style="margin-top: 6px;">已结算总金额：<label style="color: red">{$finish_amount}</label></p></li>
    </div>
</div>
<div class="main ">

    <div class="panel panel-default">
        <div class="panel-heading">
            收益列表
        </div>

        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row" id="accordion">


                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <td  class="store_td1 col-md-1">门店名称</td>
                        <td  class="col-md-1">总金额 </td>
                        <td  class="col-md-1">车主费用</td>
                        <td  class="col-md-1">门店收益</td>
                        <td  class="col-md-1">状态</td>
                        <td class="col-md-1">创建时间</td>
                        <td class="col-md-1">结算时间</td>
<!--                        <td>操作</td>-->
                    </tr>

                    {loop $info $key $item}
                    <tbody>
                    <tr class="yg5_tr2" >
                        <td>{$item['branch_name']}</td>
                        <td>{$item['total']}</td>
                        <td>{$item['store_cost']}</td>
                        <td>{$item['amount']}</td>
                        <td>
                            {if $item['status']==0}
                            <span class="label store-yellow btn">待结算</span>
                            {elseif $item['status']==1}
                            <span class="label store-blue btn">已结算</span>
                            {/if}
                        </td>
                        <td>{$item['createtime']}</td>
                        <td>{$item['income_time']}</td>
                    </tr>
                    </tbody>
                    {/loop}
                    {if empty($info)}
                    <tr class="yg5_tr2">
                        <td colspan="8">
                            暂无收益信息
                        </td>
                    </tr>
                    {/if}
                </table>
            </div>
        </div>

    </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-1").show();
        $("#yframe-1").addClass("wyactive");
    })
    function del(id) {
        var ret = confirm("删除前请确认该门店所有车辆均已下架，您确定删除吗？")
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=branchslist&op=delete&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id},
                success:function(res){
                    console.log(res);
                    location.reload();
                    // if(res.status == 1) {
                    //     layer.msg(res.message, {icon: 1});
                    //     location.href ="{php echo $this->createWebUrl('renting')}";
                    // }else{
                    //     layer.msg(res.message, {icon: 6});
                    //     location.href =res.url;
                    // }
                }
            })
        }
    }
</script>